<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html>

<head>
	<title>
		homework
	</title>


	<script>
	</script>
	<script type="text/javascript" src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
	<script>
		function sumbitMessage(title,content,username) {
			window.location.href="/teacher/reviewHomework?title="+title+"&content="+content+"&username="+username;
		}

	</script>
	<link type ="text/css" rel = "stylesheet" href = "/static/css/design.css">
	<style type="text/css" >
		a:link{text-decoration: none;color: white}

		a:active{text-decoration:none}

		a:hover{text-decoration:none;color: white}

		a:visited{text-decoration: none;color: white}


		*{
			margin: 0;
			padding: 0;

		}

		html{
			margin: 0;
			padding:0px;
			height:100%;

		}
		body{

			background-size:cover;
			background-attachment:fixed;



	</style>

</head>
<body>



<div id = 'menu'>



	<ul>

		<li><a href="" ><p style="font-size:15px;color:rgb(230,230,230);">提交作业统计</p></a></li>



	</ul>
</div>





<div id = 'centerPanel2'>

	<table id="homeworkListTable" width="90%" class="table">

	</table>
</div>








	<script>
		$(function () {
			var url = decodeURI(window.location.href);
			// alert(url)
			var argsIndex = url .split("?title=");
			var arg = argsIndex[1];
			// alert(arg)

			url_spc = "http://localhost:8080/teacher/queryOneHomeworkSumbit?title="+arg
			$.ajax({
				url: url_spc,
				type:"get",

				success:function (homeworksdata) {


					var tabletab = $("<caption>\n" +
							"\t\t\t\t\t<h2>作业提交情况统计</h2><br>\n" +
							"\t\t\t\t</caption>\n" +
							"\t\t\t\t<thead>\n" +
							"\t\t\t\t\t<tr>\n" +
							"\t\t\t\t\t\t<th>学生用户名</th>\n" +
							"\t\t\t\t\t\t<th>作业题目</th>\n" +
							"\t\t\t\t\t\t<th>作业内容</th>\n" +
							"\t\t\t\t\t\t<th>分数</th>\n" +
							"\t\t\t\t\t\t<th>评语</th>\n" +
							"\t\t\t\t\t\t<th>作业创建时间</th>\n" +
							"\t\t\t\t\t\t<th>批阅</th>\n" +
							"\n" +
							"\t\t\t\t\t</tr>\n" +
							"\t\t\t\t</thead>")
					$(tabletab).appendTo("#homeworkListTable")


					var homeworklist = homeworksdata.data
					for(var i = 0;i<homeworklist.length;i++){
						addItem(homeworklist[i].student_username,homeworklist[i].homework_title,homeworklist[i].homework_content,homeworklist[i].grade,homeworklist[i].comment,homeworklist[i].create_time)
					}

				},
				error:function (xhr,errorText,errorType) {
					alert('错误');	//自定义错误
					alert(errorText + ':' + errorType);
				},

				// crossDomain: true,
				// dataType: 'jsonp'
			})

		});

		function addItem(username,title,content,grade,comment,creat_time) {
			var tabcontent = $("<tr>><td >"+username+"</td>\n" +
					"\t\t\t\t\t<td >"+title+"</td>\n" +
					"\t\t\t\t\t<td>"+content+"</td>\n" +
					"\t\t\t\t\t<td>"+grade+"</td>\n" +
					"\t\t\t\t\t<td>"+comment+"</td>\n" +
					"\t\t\t\t\t<td>"+creat_time+"</td>\n"+
					"\t\t\t\t\t<td><button value='批阅' onclick=\"sumbitMessage(\'" + title + "\',\'" + content + "\',\'" + username + "\')\">批阅</button>\n</tr>")
			$(tabcontent).appendTo("#homeworkListTable")

		}


	</script>






</body>



</html>